#ifndef _I2C_H_
#define _I2C_H_

#include "STMFCT.h"

typedef struct
{
    uint8_t slave_address;
    uint8_t reg;
    uint8_t data;
    bool send_flag;
    bool receive_flag;
    uint8_t receive_i;
    uint16_t BUF_SIZE;
    uint8_t receive_size;
    uint8_t *BUF;
} I2Cx_Typedef;

#define I2C1_ClockSpeed 50000
#define I2C2_ClockSpeed 50000

I2Cx_Typedef* I2C_pointer(I2C_TypeDef* I2Cx);
void I2C_waitBusy(I2C_TypeDef* I2Cx);
void I2C_init(I2C_TypeDef *I2Cx, uint8_t slave_address);
void I2C_writeReg(I2C_TypeDef* I2Cx, uint8_t reg, uint8_t Data);
void I2C_readReg(I2C_TypeDef* I2Cx, uint8_t reg, uint8_t size);

#endif
